package com.example.good.controller;

import com.example.good.entity.District;
import com.example.good.service.IDistrictService;
import com.example.good.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("district")
@CrossOrigin(value = "http://localhost:8086")
public class DistrictController extends BaseController{
    @Autowired
    private IDistrictService districtService;
    @RequestMapping({"/",""})
    public JsonResult<List<District>> getByCode(
            String code){
        List<District> data = districtService.getByParentCode(code);
        return new JsonResult<>(OK,data);
    }
}
